#!/usr/bin/python
# -*- coding: utf-8 -*-
#Under the terms of the General Public License v.3
#For more information see LICENSE.txt

from Element import *
import thread
import pygame

class Item(Element):
	
	def __init__(self, image, posX, posY):
		Element.__init__(self, image, posX, posY)
		self.initConstants()
		self.isTaken(False)
		self.image.set_colorkey(self.TRANSPARENT_COLOR)

	def initConstants(self):
		self.TRANSPARENT_COLOR = (0xFF, 0xFF, 0xFF)
		self.PAINT_DELAY_MS = 50

	def isTaken(self):
		return self.taken

	def isTaken(self, taken):
		self.taken = taken

	def paint(self, screen):
		thread.start_new_thread(self.paintThread, (screen, 0))

	def paintThread(self, screen, nothing):
		while (not self.isTaken()):
			Element.paint(self, screen)
			pygame.time.delay(self.PAINT_DELAY_MS)
	
	def action(self):
		pass
